package main;

// Nikolas Wolfe
// 2/9/2009
// CIS 4930
// Towers of Hanoi

/*
 * This is the driver class which starts the three threads that
 * execute the puzzle.
 */

public class HanoiDriver
{
	public static void main(String[] args)
	{
		// Create towers
		TowersOfHanoi towersOfHanoi = new TowersOfHanoi(Integer.parseInt(args[0]));
		System.out.println(towersOfHanoi.toString());
		
		// Create tower watchers
		TowerWatcher meep1 = new TowerWatcher(towersOfHanoi.getTowerA(), towersOfHanoi, "Thread A");
		TowerWatcher meep2 = new TowerWatcher(towersOfHanoi.getTowerB(), towersOfHanoi, "Thread B");
		TowerWatcher meep3 = new TowerWatcher(towersOfHanoi.getTowerC(), towersOfHanoi, "Thread C");
		
		// Supply tower watchers with an execution strategy
		meep1.setStategy(new ConcreteStupidExecution(meep1));
		meep2.setStategy(new ConcreteStupidExecution(meep2));
		meep3.setStategy(new ConcreteStupidExecution(meep3));

//		meep1.setStategy(new ConcreteSmartExecution(meep1));
//		meep2.setStategy(new ConcreteSmartExecution(meep2));
//		meep3.setStategy(new ConcreteSmartExecution(meep3));
		
//		meep1.setStategy(new ConcreteSmarterExecution(meep1));
//		meep2.setStategy(new ConcreteSmarterExecution(meep2));
//		meep3.setStategy(new ConcreteSmarterExecution(meep3));

		// Create 3 threads
		Thread threadA = new Thread(meep1);
		Thread threadB = new Thread(meep2);
		Thread threadC = new Thread(meep3);
		
		// start the threads
		threadA.start();
		threadB.start();
		threadC.start();
	}

}
